#!/usr/bin/ruby
require 'gtk2'
require 'libglade2'
Gtk.init

@glade = GladeXML.new('Impostazioni.glade')
@glade.widget_names.each do |name|
      instance_variable_set("@#{name}".intern, @glade[name])
end

@combobox1.signal_connect('changed') do
  home = `echo $HOME`.chop
  cho = File.new("#{home}/.jamendo/impostazioni.txt", "w+")
  cho.puts "#{@combobox1.active_text}\n"
  cho.puts "#{@combobox2.active_text}\n"
  cho.close
  puts "cambiato valore!"
end

@combobox2.signal_connect('changed') do
  home = `echo $HOME`.chop
  cho = File.new("#{home}/.jamendo/impostazioni.txt", "w+")
  cho.puts "#{@combobox1.active_text}\n"
  cho.puts "#{@combobox2.active_text}\n"
  cho.close
  puts "cambiato valore!"
end

@button1.signal_connect('clicked') do
  Gtk.main_quit
end
@window1.signal_connect('destroy') do
  Gtk.main_quit
end

@window1.show_all
Gtk.main
